package com.cyzy.controller;

import com.cyzy.domain.TAddress;
import com.cyzy.dto.ResponseData;
import com.cyzy.service.TAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/TAddress")
public class TAddressController {
    @Autowired
    private TAddressService tAddressService;

  @PostMapping("/insterTAddress")
    public ResponseData insterTAddress(@RequestBody TAddress tAddress) {
    return   tAddressService.addAddress(tAddress);
  }
  @GetMapping("/getTAddress")
    public ResponseData getTAddress( int userId) {
      return   tAddressService.getAddress(userId);
  }
  @PostMapping("/updateAddress")
    public int updateAddress(@RequestBody TAddress tAddress) {
      return   tAddressService.updateAddress(tAddress);
  }
  @GetMapping("/deleteAddress")
    public int deleteAddress( int addressId ,int userId) {
      return tAddressService.deleteAddress(addressId,userId);
  }
  @PostMapping("/SetAddress")
  public int SetAddress(@RequestBody TAddress tAddress) {
    return   tAddressService.updateAddress(tAddress);
  }
  @GetMapping("/getAddres")
  public ResponseData getAddres( String userId) {
    return   tAddressService.getAddres(userId);
  }
}
